package com.ruoyi.web.sso.service.impl;

import java.math.BigDecimal;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.web.sso.common.util.UuidUtil;
import com.ruoyi.web.sso.domain.vo.MilepostList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.web.sso.mapper.MilepostMapper;
import com.ruoyi.web.sso.domain.Milepost;
import com.ruoyi.web.sso.service.IMilepostService;
import com.ruoyi.common.core.text.Convert;

/**
 * 里程碑Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-11-05
 */
@Service
public class MilepostServiceImpl implements IMilepostService 
{
    @Autowired
    private MilepostMapper milepostMapper;

    /**
     * 查询里程碑
     * 
     * @param id 里程碑主键
     * @return 里程碑
     */
    @Override
    public Milepost selectMilepostById(String id)
    {
        return milepostMapper.selectMilepostById(id);
    }

    /**
     * 查询里程碑列表
     * 
     * @param milepost 里程碑
     * @return 里程碑
     */
    @Override
    public List<MilepostList> selectMilepostList(Milepost milepost)
    {
        return milepostMapper.selectMilepostList(milepost);
    }

    /**
     * 新增里程碑
     * 
     * @param milepost 里程碑
     * @return 结果
     */
    @Override
    public int insertMilepost(Milepost milepost)
    {
        milepost.setId(UuidUtil.getUuid());
        milepost.setCreateTime(DateUtils.getNowDate());
        return milepostMapper.insertMilepost(milepost);
    }

    /**
     * 修改里程碑
     * 
     * @param milepost 里程碑
     * @return 结果
     */
    @Override
    public int updateMilepost(Milepost milepost)
    {
        milepost.setUpdateTime(DateUtils.getNowDate());
        return milepostMapper.updateMilepost(milepost);
    }

    /**
     * 批量删除里程碑
     * 
     * @param ids 需要删除的里程碑主键
     * @return 结果
     */
    @Override
    public int deleteMilepostByIds(String ids)
    {
        return milepostMapper.deleteMilepostByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除里程碑信息
     * 
     * @param id 里程碑主键
     * @return 结果
     */
    @Override
    public int deleteMilepostById(String id)
    {
        return milepostMapper.deleteMilepostById(id);
    }

    public static void main(String[] args) {
        double y = 0.1;
        Double totalAmount  =  Double.valueOf(10)/100;
        System.out.println(totalAmount);
        System.out.println(new BigDecimal((int)(y*100)));
    }
}
